package cn.edu.gdut.csq.service;

import org.springframework.context.annotation.Bean;
import org.springframework.web.socket.TextMessage;

import cn.edu.gdut.csq.config.SpringWebSocketHandler;


//@Component
public class TimingJobService {

	
	
    @Bean//这个注解会从Spring容器拿出Bean
    public SpringWebSocketHandler infoHandler() {
        return new SpringWebSocketHandler();
    }

	// @Scheduled(initialDelay=1000, fixedRate=5000)
	public void doSomething() {
		// something that should execute periodically
	}

	// @Scheduled(cron = "0/1 * * * * ?")
	public void job() {
		System.out.println("任务进行中。。。");
		infoHandler().sendMessageToUsers(new TextMessage("你好，测试！！！！"));
	}
}
